package com.example.springboot_4_knife4j.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Knife4jConfiguration {

    @Bean
    public OpenAPI openAPI() {
        //定义作者的名称
        Contact contact = new Contact();
        contact.setName("王狗蛋");

        return new OpenAPI()
                .info(new Info()
                        .title("用户系统管理")
                        .contact(contact)
                        .version("1.0")
                        .description("用户管理的系统接口文档"));
    }


    @Bean
    public GroupedOpenApi userAPI(){
        return GroupedOpenApi.builder()
                .group("user")
                .displayName("用户接口")
                .pathsToMatch("/user/**").build();
    }

    @Bean
    public GroupedOpenApi deptAPI(){
        return GroupedOpenApi.builder()
                .group("dept")
                .displayName("部门接口")
                .pathsToMatch("/dept/**").build();
    }

}
